<extend name="Public/base" />
<block name="style"> <script
	src="__STATIC__/thinkbox/jquery.thinkbox.js"></script> <script
	type="text/javascript" src="__STATIC__/qtip/jquery.qtip.min.js"></script>
<link rel="stylesheet" type="text/css"
	href="__STATIC__/qtip/jquery.qtip.min.css" media="all">
</block>
<block name="body"> <!-- 标题栏 -->
<div class="main-title">
	<h2>
		{$iteminfo['name']}&nbsp;[
		<present name="Think.get.questiontype"> <a
			href="{:U('index',array('itembank'=>$iteminfo['id'],'chapter'=>$chapter_id))}">全部</a>
		<else /> <strong>全部</strong> </present>
		&nbsp;
		<foreach name="questiontype" item="vo"> <neq
			name="questiontype_id" value="$vo"> <a
			href="{:U('index',array('itembank'=>$iteminfo['id'],'questiontype'=>$vo,'chapter'=>$chapter_id))}">{$vo|get_questiontype_name}</a>
		<else /> <strong>{$vo|get_questiontype_name}</strong> </neq>&nbsp; </foreach>
		]
	</h2>
</div>
<div class="cf">
	<div class="fl">
		<a class="btn"
			href="{:U('add',array('itembank'=>$iteminfo['id'],'questiontype'=>$questiontype_id,'chapter'=>$chapter_id))}">新
			增</a> <a class="btn ajax-post confirm" href="{:U('del')}"
			target-form="ids">删 除</a> <a class="btn"
			href="{:U('ItemBank/myitems')}">返 回</a>
	</div>

	<!-- 高级搜索 -->
	<div class="search-form fr cf">
		<div class="sleft">
			<div class="drop-down" style="width: auto;">
				<span id="sch-sort-txt" class="sort-txt" style="width: auto;"><present
						name="Think.get.chapter">{$chapter_id|get_chapter_name}<else />所有章节</present></span>
				<i class="arrow arrow-down"></i>
				<ul id="sub-sch-menu" class="nav-list hidden">
					<li><a
						href="{:U('index',array('itembank'=>$iteminfo['id'],'questiontype'=>$questiontype_id))}">所有章节</a></li>
					<foreach name="chapter" item="vo">
					<li><a
						href="{:U('index',array('itembank'=>$iteminfo['id'],'questiontype'=>$questiontype_id,'chapter'=>$vo))}"
						value="$vo">{$vo|get_chapter_name}</a></li>
					</foreach>
				</ul>
			</div>
			<input type="text" name="title" class="search-input"
				value="{:I('title')}" placeholder="请输入题目内容"> <a
				class="sch-btn" href="javascript:;" id="search"
				url="{:U('index',array('itembank'=>$iteminfo['id'],'questiontype'=>$questiontype_id,'chapter'=>$chapter_id))}"><i
				class="btn-search"></i></a>
		</div>
	</div>
</div>
<!-- 数据列表 -->
<div class="data-table table-striped">
	<table style="table-layout: fixed;">
		<thead>
			<tr>
				<th class="row-selected row-selected"><input class="check-all"
					type="checkbox" /></th>
				<th style="width: 5%;">序号</th>
				<th style="width: 30%;">题目</th>
				<th>类型</th>
				<th>章节</th>
				<th>难度</th>
				<th>空行</th>
				<th>状态</th>
				<th>附件</th>
				<th>答案</th>
				<th>操作</th>
			</tr>
		</thead>
		<tbody>
			<notempty name="list"> <assign name="i" value="1" /> <volist
				name="list" id="vo">
			<tr>
				<td><input class="ids" type="checkbox" name="id[]"
					value="{$vo.id}" /></td>
				<td>{$i}</td>
				<td class="questiontitle" style="width: 30%; overflow: hidden;"
					nowrap="nowrap">{$vo.title}</td>
				<td>{$vo.questiontype|get_questiontype_name}</td>
				<td>{$vo.chapter|get_chapter_name}</td>
				<td>{$vo.difficulty|get_difficulty_name}</td>
				<td>{$vo.answer_rows}</td>
				<td><if condition="$vo.status eq 1">正常<else />禁用</if></td>
				<td><a title="附件"
					href="{:U('QuestionAttachments/index?id='.$vo['id'])}">管理</a></td>
				<td><a title="答案"
					href="{:U('QuestionAnswers/index?id='.$vo['id'])}">管理</a></td>
				<td><a title="编辑" href="{:U('edit?id='.$vo['id'])}">编辑</a> <a
					class="confirm ajax-get" title="禁用" href="#">禁用</a>
				<assign name="i" value="$i++" />
			</tr>
			</volist> <else />
			<td colspan="9" class="text-center">暂时还没有内容!</td>
			</notempty>
		</tbody>
	</table>
</div>
<div class="page">{$_page}</div>
</block>

<block name="script"> <script type="text/javascript">
	+function($){
		$('.questiontitle').each(function(){
	        $(this).qtip({
	            content: {
	                text: $(this).text(),
	                title: ' ',
	            },
	            position: {
	                my: 'top center',
	                at: 'bottom center',
	                target: $(this)
	            },
	            style: {
	                classes: 'qtip-green',
	                tip: {
	                    corner: true,
	                    mimic: false,
	                    width: 5,
	                    height: 5
	                }
	            }
	        });
	    });
		
		//搜索功能
		$("#search").click(function(){
			var url = $(this).attr('url');
	        var query  = $('.search-form').find('input').serialize();
	        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
	        query = query.replace(/^&/g,'');
	        if( url.indexOf('?')>0 ){
	            url += '&' + query;
	        }else{
	            url += '?' + query;
	        }
			window.location.href = url;
		});
		
		/* 状态搜索子菜单 */
		$(".search-form").find(".drop-down").hover(function(){
			$("#sub-sch-menu").removeClass("hidden");
		},function(){
			$("#sub-sch-menu").addClass("hidden");
		});
		$("#sub-sch-menu li").find("a").each(function(){
			$(this).click(function(){
				$("#sub-sch-menu").addClass("hidden");
			})
		});

		
		//回车搜索
		$(".search-input").keyup(function(e){
			if(e.keyCode === 13){
				$("#search").click();
				return false;
			}
		});
	    //导航高亮
	    $('.side-sub-menu').find('a[href="{:U('ItemBank/myitems')}"]').closest('li').addClass('current');
	}(jQuery);
	
	</script> </block>